package com.cjl.service.impl;

import com.cjl.entity.EbUser;
import com.cjl.mapper.UserMapper;
import com.cjl.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * alt+enter
 */

import java.util.List;

@Service //让spring 帮我们new一个对象；
//相当于
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<EbUser> listByPage(Integer page, Integer pageSize) {
        System.out.println("调用了service层");
        int from = (page-1)*pageSize;
        return userMapper.findByPage(from, pageSize);
    }
    @Override
    public  Integer findTotalPage(Integer pageSize){
        return  userMapper.getTotalPage(pageSize);
    }
    @Override
    public Integer save(EbUser ebUser){
        return userMapper.save(ebUser);
    }
    @Override
    public Integer delete(String id){
        return userMapper.delete(id);
    }

    @Override
    public Integer updateById(EbUser ebUser){
        return userMapper.updateByPrimaryKey(ebUser);
    }

    @Override
    public EbUser selectOne(String euUserId){
        return userMapper.selectOne(euUserId);
    }
}
